new Vue({
	el: '#app',
	data: {
		uid: '',
		tid: '',
		tIntroduce: '',
		star: ''
	},
	mounted: function() {
		console.log("mounted end");
		this.init();
	},
	methods: {
		init: function() {
			var self = this;
			apiready = function() {
				var fid = api.pageParam;
				console.log(fid.tid);
				self.tid = fid.tid;
				//loading加载
				self.isS();
			}
		},
		isS: function() {
			var self = this;
			var UILoading = api.require('UILoading');
			if(self.isShow) {
				console.log(self.loadingId);
				UILoading.closeFlower({
					id: self.loadingId
				});
			} else {
				UILoading.flower({
					center: {
						x: api.winWidth / 2.0,
						y: api.winHeight / 2.0
					},
					size: 30,
					fixed: true
				}, function(ret) {
					console.log(JSON.stringify(ret));
					self.loadingId = ret.id;
				});
				self.getTeacherMsg();
			}
		},
		//获得老师信息
		getTeacherMsg: function() {
			var self = this;
			var data = {
				teacher_id: self.tid
			};
			$.post(base + config.teacher_introduce, data, function(msg) {
				console.log(msg);
				if(msg.error == 0) {
					self.tIntroduce = msg.data;
					self.star = msg.data.level;
					self.isShow = true;
					self.isS();
				} else {
					self.isShow = true;
					self.isS();
					console.log(msg.error_msg);
					api.toast({
						msg: msg.error_msg,
						duration: 2000,
						location: 'middle'
					});
				}
			}, 'json');
		}
	}
})